<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 导入vue -->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>
</head>
<body>
    <!-- 未登录时为请登录，已登录时为你好欢迎 -->
    <div id="app">
        <div v-if='!token'>请登录</div>
        <div v-else>欢迎你</div>
        <button @click='login' v-show='!token'>登录</button>
    </div>
    <script>
        new Vue({
            el:'#app',
            data(){
                return {
                    token:''
                }
            },
            methods: {
                login() {
                    this.token = Math.random()
                }
            }
        })
    </script>
</body>
</html>